// 角色管理
import axios from "@/request/axios";

// 新增角色
export function roleAdd(params: any) {
  return axios({
    url: "/system/role/add",
    method: "post",
    data: params,
  });
}

// 删除角色
export function roleDel(ids: any) {
  return axios({
    url: "/system/role/del",
    method: "post",
    data: ids,
  });
}

// 修改角色
export function roleEdit(params: any) {
  return axios({
    url: "/system/role/edit",
    method: "post",
    data: params,
  });
}

// 根据角色Id获取角色信息
export function getRoleById(id: any) {
  return axios({
    url: "/system/role/detail",
    method: "post",
    data: { id }
  });
}

// 根据用户Id获取角色列表
export function getRoleByUserId(id: any) {
  return axios({
    url: "/system/role/getRoleByUserId",
    method: "post",
    data: { id }
  });
}

// 获得角色下拉框
export function getRoleTree() {
  return axios({
    url: "/system/role/getRoleList",
    method: "post",
  });
}

// 条件查询（分页）
export function roleQuery(params:any) {
  return axios({
    url: "/system/role/query",
    method: "post",
    data: params
  });
}